<div
    bsModal
    #createOrEditModal="bs-modal"
    (onShown)="onShown()"
    class="modal fade"
    tabindex="-1"
    role="dialog"
    aria-labelledby="createOrEditModal"
    aria-hidden="true"
    [config]="{ backdrop: 'static', keyboard: !saving }"
>
    <div class="modal-dialog">
        <div class="modal-content">
            <form *ngIf="active" #editForm="ngForm" novalidate (ngSubmit)="save()">
                <div class="modal-header">
                    <h5 class="modal-title">
                        <span *ngIf="dataitemUnit.id">修改字典分类: {{ dataitemUnit.displayName }}</span>
                        <span *ngIf="!dataitemUnit.id">新增字典分类</span>
                    </h5>
                    <button
                        type="button"
                        class="close"
                        (click)="close()"
                        [attr.aria-label]="l('Close')"
                        [disabled]="saving"
                    >
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>

                <div class="modal-body">
                    <div class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label for="dataitemUnitDisplayName">名称*</label>
                        <input
                            id="dataitemUnitDisplayName"
                            #dataitemUnitDisplayName="ngModel"
                            class="form-control"
                            type="text"
                            name="displayName"
                            [ngClass]="{ edited: dataitemUnit.displayName }"
                            [(ngModel)]="dataitemUnit.displayName"
                            required
                            maxlength="128"
                        />
                        <validation-messages [formCtrl]="dataitemUnitDisplayName"></validation-messages>
                    </div>
                    <div class="form-group">
                        <label for="code">编号*</label>
                        <input
                            id="code"
                            type="text"
                            name="code"
                            class="form-control"
                            [ngClass]="{ edited: dataitemUnit.code }"
                            [(ngModel)]="dataitemUnit.code"
                            required
                            maxlength="24"
                        />
                    </div>
                    <!-- <div class="form-group">
                                <label for="sortCode">排序*</label>
                                <input id="sortCode" type="number" name="sortCode" class="form-control"  [ngClass]="{'edited': dataitemUnit.sortCode}" [(ngModel)]="dataitemUnit.sortCode" required maxlength="24">
                            </div> -->
                </div>

                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-default" (click)="close()">
                        {{ 'Cancel' | localize }}
                    </button>
                    <button
                        type="submit"
                        class="btn btn-primary"
                        [disabled]="!editForm.form.valid"
                        [buttonBusy]="saving"
                        [busyText]="l('SavingWithThreeDot')"
                    >
                        <i class="fa fa-save"></i> <span>{{ 'Save' | localize }}</span>
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
